import random
import numpy


class RandomUtil:
    @classmethod
    def eq_rand_int(cls, start_num:int, end_num:int):
        """
        等概率随机数
        :param start_num:
        :param end_num:
        :return:
        """
        return random.randint(start_num, end_num)

    @classmethod
    def eq_choice(cls, lists):
        """
        等概率抽取
        :param lists:
        :return:
        """
        return random.choice(lists)

    @classmethod
    def normal_rand_int(cls, min_value, max_value, mean, std):
        """
        正态分布随机数，产生[min_value, max_value]之间的数字，出现的概率和mean与std相关
        :param min_value:
        :param max_value:
        :param mean:
        :param std:
        :return:
        """

        # 生成正态分布随机数
        random_numbers = numpy.random.normal(mean, std, 10)
        # 转换成整数
        random_ints = numpy.round(random_numbers).astype(int)
        # 归一化
        randomints = numpy.clip(random_ints, min_value, max_value)

        return randomints[0]


if __name__ == "__main__":
    pass